package TCPEcho;

import java.io.IOException;
import java.util.HashMap;

public class TcpDicSever extends TcpEchoSever{
    private HashMap<String,String> hashMap = new HashMap<>();
    public TcpDicSever(int port) throws IOException {
        super(port);

        hashMap.put("cat","小猫");
        hashMap.put("dog","小狗");
        hashMap.put("chicken","小鸡");
    }

    @Override
    public String process(String request) {
        return hashMap.getOrDefault(request,"你要查找的单词不存在");
    }

    public static void main(String[] args) throws IOException {
     TcpDicSever tcpDicSever = new TcpDicSever(1060);
     tcpDicSever.start();
    }
}
